package com.cw2.behavioral.interpreter1;

import java.util.Set;

public class TerminalExpression1 extends IDCardExpression1 {

    Set<String> data;

    String spilt;


    public TerminalExpression1(Set<String> data, String spilt) {
        this.data = data;
        this.spilt = spilt;
    }

    /**
     * 定义分割规则
     * @param expression
     * @return
     */
    @Override
    boolean interpreter1(String expression) {
        String[] split = expression.split(spilt);
        for (String s : split) {
            if (data.contains(s)){
                return true;
            }
        }
        return false;
    }
}
